package com.iwhalecloud.citybrain.flow.platform.manager.infrastructure.web;

import com.iwhalecloud.citybrain.flow.platform.manager.common.ResponseResult;
import com.iwhalecloud.citybrain.flow.platform.manager.application.service.FlowExecutionQueryService;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.repository.FlowIssueNoticeRepository;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.CountVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author huheng
 * @date 2019/5/23 2:46 PM
 */
@RestController
@RequestMapping("/count")
public class FlowCountController {

    @Autowired
    private FlowExecutionQueryService flowExecutionQueryService;

    @Autowired
    private FlowIssueNoticeRepository flowIssueNoticeRepository;

    /**
     * 应用列表
     */
    @PostMapping("/count")
    public ResponseResult listAll() {
        CountVo countVo = new CountVo();
        countVo.setCountTodu(flowExecutionQueryService.countTodo());
        countVo.setCountIssueNotice(flowIssueNoticeRepository.countIssueNotice());
        countVo.setCountProcessed(flowExecutionQueryService.countProcessed());
        countVo.setCountLaunchedProcess(flowExecutionQueryService.countLaunchedProcess());
        return ResponseResult.success(countVo);
    }
}
